home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 051-060 / amok52 / gadgeted / txt / req2.mod < prev    next >
Text File  |  1993-11-04  |  14KB  |  556 lines

  1. IMPLEMENTATION MODULE Req2;
  2. (* Erstellen einer Gadget-Struktur *)
  3.  
  4. FROM SYSTEM    IMPORT ADR,ADDRESS;
  5. FROM Intuition IMPORT NewWindow, WindowPtr, IDCMPFlags, IDCMPFlagSet,
  6.                       WindowFlags, WindowFlagSet, ScreenFlags,
  7.                       ScreenFlagSet, OpenWindow, CloseWindow,
  8.                       customScreen, Gadget, IntuiText, Border,
  9.                       StringInfo, PropInfo, GadgetFlagSet, 
  10.                       GadgetFlags, ActivationFlags, AddGList,
  11.                       ActivationFlagSet, boolGadget, strGadget,
  12.                       propGadget, PropInfoFlagSet, PropInfoFlags,
  13.                       RefreshGList;
  14. FROM Graphics  IMPORT jam1, jam2;
  15.  
  16.  
  17. TYPE XYTyp = ARRAY [0..9] OF INTEGER;
  18.      BufTyp = ARRAY [0..255] OF CHAR;
  19.  
  20. VAR GadgWindow : NewWindow;
  21.     WPtr       : WindowPtr;
  22.     Pos        : INTEGER;
  23.     Gadgets : ARRAY [0..7] OF Gadget;
  24.     Borders : ARRAY [0..10] OF Border;
  25.     XY      : ARRAY [0..10] OF XYTyp;
  26.     GText   : ARRAY [0..7] OF IntuiText;
  27.     SInfo   : ARRAY [0..4] OF StringInfo;
  28.     Buf     : ARRAY [0..4] OF BufTyp;
  29.     UBuf    : BufTyp;
  30.  
  31.  
  32. PROCEDURE InitReq2
  33.                         (VAR wptr   : ADDRESS;
  34.                              Screen : ADDRESS;
  35.                              Title  : ADDRESS);
  36. (* Aufbau der Gadget-Struktur im Window *)
  37.  
  38. BEGIN
  39.  
  40. (* Window aufbauen *)
  41. (*-----------------*)
  42.  
  43.  IF (wptr = NIL) THEN
  44.  
  45.    WITH GadgWindow DO
  46.      leftEdge := 110; topEdge := 41;
  47.      width := 409; height := 135;
  48.      detailPen := 0; blockPen := 1;
  49.      idcmpFlags := IDCMPFlagSet{gadgetDown,gadgetUp,closeWindow};
  50.      flags := WindowFlagSet{windowDrag,windowDepth,
  51.                             windowClose,activate};
  52.      firstGadget := ADR(Gadgets[0]);
  53.      checkMark := NIL;
  54.      title := Title;
  55.      screen := Screen;
  56.      bitMap := NIL;
  57.      minWidth := 30; minHeight := 20; maxWidth := 640; maxHeight := 256;
  58.      IF (Screen # NIL) THEN
  59.        type := customScreen;
  60.      ELSE
  61.        type := ScreenFlagSet{wbenchScreen};
  62.      END; (*IF*)
  63.    END; (*WITH*)
  64.  
  65.  END; (*IF*)
  66.  
  67. (*--------------------------------------------------------------------------*)
  68.  
  69. (* Aufbau der Gadget-Strukturen *)
  70. (*------------------------------*)
  71.  
  72.  WITH Gadgets[0] DO
  73.     nextGadget := ADR(Gadgets[1]);
  74.     leftEdge := 296;
  75.     topEdge := 115;
  76.     width := 67;
  77.     height := 9;
  78.     flags := GadgetFlagSet{};
  79.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  80.     gadgetType := boolGadget;
  81.     gadgetRender := ADR(Borders[0]);
  82.     selectRender := NIL;
  83.     gadgetText := ADR(GText[0]);
  84.     specialInfo := NIL;
  85.     gadgetID := 0;
  86.     userData := NIL;
  87.  END; (*WITH*)
  88.  
  89. (* Gadget-Text *)
  90.  WITH GText[0] DO
  91.     frontPen := 1; backPen := 0;
  92.     drawMode := jam2;
  93.     leftEdge := 25; topEdge := 1;
  94.     iTextFont := NIL;
  95.     iText := ADR('OK');
  96.     nextText := NIL;
  97.  END; (*WITH*)
  98.  
  99. (* Gadget-Border(s) *)
  100.  WITH Borders[0] DO
  101.     leftEdge := -2; topEdge := -2;
  102.     frontPen := 1; backPen := 0;
  103.     drawMode := jam2;
  104.     count := 5;
  105.     xy := ADR(XY[0]);
  106.     nextBorder := ADR(Borders[1]);
  107.  END; (*WITH*)
  108.  
  109.  XY[0,0] := 0;  XY[0,1] := 0; 
  110.  XY[0,2] := 70;  XY[0,3] := 0; 
  111.  XY[0,4] := 70;  XY[0,5] := 12; 
  112.  XY[0,6] := 0;  XY[0,7] := 12; 
  113.  XY[0,8] := 0;  XY[0,9] := 0; 
  114.  
  115.  WITH Borders[1] DO
  116.     leftEdge := -5; topEdge := -4;
  117.     frontPen := 1; backPen := 0;
  118.     drawMode := jam2;
  119.     count := 5;
  120.     xy := ADR(XY[1]);
  121.     nextBorder := NIL;
  122.  END; (*WITH*)
  123.  
  124.  XY[1,0] := 0;  XY[1,1] := 0; 
  125.  XY[1,2] := 76;  XY[1,3] := 0; 
  126.  XY[1,4] := 76;  XY[1,5] := 16; 
  127.  XY[1,6] := 0;  XY[1,7] := 16; 
  128.  XY[1,8] := 0;  XY[1,9] := 0; 
  129.  
  130. (*-------------------------------------------------------*)
  131.  
  132.  WITH Gadgets[1] DO
  133.     nextGadget := ADR(Gadgets[2]);
  134.     leftEdge := 43;
  135.     topEdge := 115;
  136.     width := 67;
  137.     height := 9;
  138.     flags := GadgetFlagSet{};
  139.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  140.     gadgetType := boolGadget;
  141.     gadgetRender := ADR(Borders[2]);
  142.     selectRender := NIL;
  143.     gadgetText := ADR(GText[1]);
  144.     specialInfo := NIL;
  145.     gadgetID := 1;
  146.     userData := NIL;
  147.  END; (*WITH*)
  148.  
  149. (* Gadget-Text *)
  150.  WITH GText[1] DO
  151.     frontPen := 1; backPen := 0;
  152.     drawMode := jam2;
  153.     leftEdge := 9; topEdge := 1;
  154.     iTextFont := NIL;
  155.     iText := ADR('CANCEL');
  156.     nextText := NIL;
  157.  END; (*WITH*)
  158.  
  159. (* Gadget-Border(s) *)
  160.  WITH Borders[2] DO
  161.     leftEdge := -2; topEdge := -2;
  162.     frontPen := 1; backPen := 0;
  163.     drawMode := jam2;
  164.     count := 5;
  165.     xy := ADR(XY[2]);
  166.     nextBorder := ADR(Borders[3]);
  167.  END; (*WITH*)
  168.  
  169.  XY[2,0] := 0;  XY[2,1] := 0; 
  170.  XY[2,2] := 70;  XY[2,3] := 0; 
  171.  XY[2,4] := 70;  XY[2,5] := 12; 
  172.  XY[2,6] := 0;  XY[2,7] := 12; 
  173.  XY[2,8] := 0;  XY[2,9] := 0; 
  174.  
  175.  WITH Borders[3] DO
  176.     leftEdge := -5; topEdge := -4;
  177.     frontPen := 1; backPen := 0;
  178.     drawMode := jam2;
  179.     count := 5;
  180.     xy := ADR(XY[3]);
  181.     nextBorder := NIL;
  182.  END; (*WITH*)
  183.  
  184.  XY[3,0] := 0;  XY[3,1] := 0; 
  185.  XY[3,2] := 76;  XY[3,3] := 0; 
  186.  XY[3,4] := 76;  XY[3,5] := 16; 
  187.  XY[3,6] := 0;  XY[3,7] := 16; 
  188.  XY[3,8] := 0;  XY[3,9] := 0; 
  189.  
  190. (*-------------------------------------------------------*)
  191.  
  192.  WITH Gadgets[2] DO
  193.     nextGadget := ADR(Gadgets[3]);
  194.     leftEdge := 159;
  195.     topEdge := 115;
  196.     width := 91;
  197.     height := 9;
  198.     flags := GadgetFlagSet{};
  199.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  200.     gadgetType := boolGadget;
  201.     gadgetRender := ADR(Borders[4]);
  202.     selectRender := NIL;
  203.     gadgetText := ADR(GText[2]);
  204.     specialInfo := NIL;
  205.     gadgetID := 2;
  206.     userData := NIL;
  207.  END; (*WITH*)
  208.  
  209. (* Gadget-Text *)
  210.  WITH GText[2] DO
  211.     frontPen := 1; backPen := 0;
  212.     drawMode := jam2;
  213.     leftEdge := 5; topEdge := 1;
  214.     iTextFont := NIL;
  215.     iText := ADR('VIELLEICHT');
  216.     nextText := NIL;
  217.  END; (*WITH*)
  218.  
  219. (* Gadget-Border(s) *)
  220.  WITH Borders[4] DO
  221.     leftEdge := -2; topEdge := -2;
  222.     frontPen := 1; backPen := 0;
  223.     drawMode := jam2;
  224.     count := 5;
  225.     xy := ADR(XY[4]);
  226.     nextBorder := ADR(Borders[5]);
  227.  END; (*WITH*)
  228.  
  229.  XY[4,0] := 0;  XY[4,1] := 0; 
  230.  XY[4,2] := 94;  XY[4,3] := 0; 
  231.  XY[4,4] := 94;  XY[4,5] := 12; 
  232.  XY[4,6] := 0;  XY[4,7] := 12; 
  233.  XY[4,8] := 0;  XY[4,9] := 0; 
  234.  
  235.  WITH Borders[5] DO
  236.     leftEdge := -5; topEdge := -4;
  237.     frontPen := 1; backPen := 0;
  238.     drawMode := jam2;
  239.     count := 5;
  240.     xy := ADR(XY[5]);
  241.     nextBorder := NIL;
  242.  END; (*WITH*)
  243.  
  244.  XY[5,0] := 0;  XY[5,1] := 0; 
  245.  XY[5,2] := 100;  XY[5,3] := 0; 
  246.  XY[5,4] := 100;  XY[5,5] := 16; 
  247.  XY[5,6] := 0;  XY[5,7] := 16; 
  248.  XY[5,8] := 0;  XY[5,9] := 0; 
  249.  
  250. (*-------------------------------------------------------*)
  251.  
  252.  WITH Gadgets[3] DO
  253.     nextGadget := ADR(Gadgets[4]);
  254.     leftEdge := 162;
  255.     topEdge := 22;
  256.     width := 219;
  257.     height := 8;
  258.     flags := GadgetFlagSet{};
  259.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  260.     gadgetType := strGadget ;
  261.     gadgetRender := ADR(Borders[6]);
  262.     selectRender := NIL;
  263.     gadgetText := ADR(GText[3]);
  264.     specialInfo := ADR(SInfo[0]);
  265.     gadgetID := 3;
  266.     userData := NIL;
  267.  END; (*WITH*)
  268.  
  269. (* Gadget-Text *)
  270.  WITH GText[3] DO
  271.     frontPen := 1; backPen := 0;
  272.     drawMode := jam2;
  273.     leftEdge := -139; topEdge := 0;
  274.     iTextFont := NIL;
  275.     iText := ADR('Name');
  276.     nextText := NIL;
  277.  END; (*WITH*)
  278.  
  279. (* Gadget-Border(s) *)
  280.  WITH Borders[6] DO
  281.     leftEdge := -2; topEdge := -2;
  282.     frontPen := 1; backPen := 0;
  283.     drawMode := jam2;
  284.     count := 5;
  285.     xy := ADR(XY[6]);
  286.     nextBorder := NIL;
  287.  END; (*WITH*)
  288.  
  289.  XY[6,0] := 0;  XY[6,1] := 0; 
  290.  XY[6,2] := 222;  XY[6,3] := 0; 
  291.  XY[6,4] := 222;  XY[6,5] := 11; 
  292.  XY[6,6] := 0;  XY[6,7] := 11; 
  293.  XY[6,8] := 0;  XY[6,9] := 0; 
  294.  
  295. (* String-Info *)
  296.  WITH SInfo[0] DO
  297.     buffer := ADR(Buf[0]);
  298.     undoBuffer := ADR(UBuf);
  299.     bufferPos := 0; dispPos := 0;
  300.     maxChars := 30;
  301.     longInt := 0;
  302.  END; (*WITH*)
  303.  
  304. (*-------------------------------------------------------*)
  305.  
  306.  WITH Gadgets[4] DO
  307.     nextGadget := ADR(Gadgets[5]);
  308.     leftEdge := 162;
  309.     topEdge := 37;
  310.     width := 219;
  311.     height := 8;
  312.     flags := GadgetFlagSet{};
  313.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  314.     gadgetType := strGadget ;
  315.     gadgetRender := ADR(Borders[7]);
  316.     selectRender := NIL;
  317.     gadgetText := ADR(GText[4]);
  318.     specialInfo := ADR(SInfo[1]);
  319.     gadgetID := 4;
  320.     userData := NIL;
  321.  END; (*WITH*)
  322.  
  323. (* Gadget-Text *)
  324.  WITH GText[4] DO
  325.     frontPen := 1; backPen := 0;
  326.     drawMode := jam2;
  327.     leftEdge := -139; topEdge := 0;
  328.     iTextFont := NIL;
  329.     iText := ADR('Straße');
  330.     nextText := NIL;
  331.  END; (*WITH*)
  332.  
  333. (* Gadget-Border(s) *)
  334.  WITH Borders[7] DO
  335.     leftEdge := -2; topEdge := -2;
  336.     frontPen := 1; backPen := 0;
  337.     drawMode := jam2;
  338.     count := 5;
  339.     xy := ADR(XY[7]);
  340.     nextBorder := NIL;
  341.  END; (*WITH*)
  342.  
  343.  XY[7,0] := 0;  XY[7,1] := 0; 
  344.  XY[7,2] := 222;  XY[7,3] := 0; 
  345.  XY[7,4] := 222;  XY[7,5] := 11; 
  346.  XY[7,6] := 0;  XY[7,7] := 11; 
  347.  XY[7,8] := 0;  XY[7,9] := 0; 
  348.  
  349. (* String-Info *)
  350.  WITH SInfo[1] DO
  351.     buffer := ADR(Buf[1]);
  352.     undoBuffer := ADR(UBuf);
  353.     bufferPos := 0; dispPos := 0;
  354.     maxChars := 30;
  355.     longInt := 0;
  356.  END; (*WITH*)
  357.  
  358. (*-------------------------------------------------------*)
  359.  
  360.  WITH Gadgets[5] DO
  361.     nextGadget := ADR(Gadgets[6]);
  362.     leftEdge := 162;
  363.     topEdge := 52;
  364.     width := 44;
  365.     height := 8;
  366.     flags := GadgetFlagSet{};
  367.     activation := ActivationFlagSet{relVerify,gadgImmediate,stringRight,longint};
  368.     gadgetType := strGadget ;
  369.     gadgetRender := ADR(Borders[8]);
  370.     selectRender := NIL;
  371.     gadgetText := ADR(GText[5]);
  372.     specialInfo := ADR(SInfo[2]);
  373.     gadgetID := 5;
  374.     userData := NIL;
  375.  END; (*WITH*)
  376.  
  377. (* Gadget-Text *)
  378.  WITH GText[5] DO
  379.     frontPen := 1; backPen := 0;
  380.     drawMode := jam2;
  381.     leftEdge := -137; topEdge := 1;
  382.     iTextFont := NIL;
  383.     iText := ADR('Postleitzahl');
  384.     nextText := NIL;
  385.  END; (*WITH*)
  386.  
  387. (* Gadget-Border(s) *)
  388.  WITH Borders[8] DO
  389.     leftEdge := -2; topEdge := -2;
  390.     frontPen := 1; backPen := 0;
  391.     drawMode := jam2;
  392.     count := 5;
  393.     xy := ADR(XY[8]);
  394.     nextBorder := NIL;
  395.  END; (*WITH*)
  396.  
  397.  XY[8,0] := 0;  XY[8,1] := 0; 
  398.  XY[8,2] := 47;  XY[8,3] := 0; 
  399.  XY[8,4] := 47;  XY[8,5] := 11; 
  400.  XY[8,6] := 0;  XY[8,7] := 11; 
  401.  XY[8,8] := 0;  XY[8,9] := 0; 
  402.  
  403. (* String-Info *)
  404.  WITH SInfo[2] DO
  405.     buffer := ADR(Buf[2]);
  406.     undoBuffer := ADR(UBuf);
  407.     bufferPos := 0; dispPos := 0;
  408.     maxChars := 5;
  409.     longInt := 0;
  410.  END; (*WITH*)
  411.  
  412. (*-------------------------------------------------------*)
  413.  
  414.  WITH Gadgets[6] DO
  415.     nextGadget := ADR(Gadgets[7]);
  416.     leftEdge := 162;
  417.     topEdge := 67;
  418.     width := 219;
  419.     height := 8;
  420.     flags := GadgetFlagSet{};
  421.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  422.     gadgetType := strGadget ;
  423.     gadgetRender := ADR(Borders[9]);
  424.     selectRender := NIL;
  425.     gadgetText := ADR(GText[6]);
  426.     specialInfo := ADR(SInfo[3]);
  427.     gadgetID := 6;
  428.     userData := NIL;
  429.  END; (*WITH*)
  430.  
  431. (* Gadget-Text *)
  432.  WITH GText[6] DO
  433.     frontPen := 1; backPen := 0;
  434.     drawMode := jam2;
  435.     leftEdge := -136; topEdge := 1;
  436.     iTextFont := NIL;
  437.     iText := ADR('Wohnort');
  438.     nextText := NIL;
  439.  END; (*WITH*)
  440.  
  441. (* Gadget-Border(s) *)
  442.  WITH Borders[9] DO
  443.     leftEdge := -2; topEdge := -2;
  444.     frontPen := 1; backPen := 0;
  445.     drawMode := jam2;
  446.     count := 5;
  447.     xy := ADR(XY[9]);
  448.     nextBorder := NIL;
  449.  END; (*WITH*)
  450.  
  451.  XY[9,0] := 0;  XY[9,1] := 0; 
  452.  XY[9,2] := 222;  XY[9,3] := 0; 
  453.  XY[9,4] := 222;  XY[9,5] := 11; 
  454.  XY[9,6] := 0;  XY[9,7] := 11; 
  455.  XY[9,8] := 0;  XY[9,9] := 0; 
  456.  
  457. (* String-Info *)
  458.  WITH SInfo[3] DO
  459.     buffer := ADR(Buf[3]);
  460.     undoBuffer := ADR(UBuf);
  461.     bufferPos := 0; dispPos := 0;
  462.     maxChars := 30;
  463.     longInt := 0;
  464.  END; (*WITH*)
  465.  
  466. (*-------------------------------------------------------*)
  467.  
  468.  WITH Gadgets[7] DO
  469.     nextGadget := NIL;
  470.     leftEdge := 162;
  471.     topEdge := 82;
  472.     width := 93;
  473.     height := 8;
  474.     flags := GadgetFlagSet{};
  475.     activation := ActivationFlagSet{relVerify,gadgImmediate};
  476.     gadgetType := strGadget ;
  477.     gadgetRender := ADR(Borders[10]);
  478.     selectRender := NIL;
  479.     gadgetText := ADR(GText[7]);
  480.     specialInfo := ADR(SInfo[4]);
  481.     gadgetID := 7;
  482.     userData := NIL;
  483.  END; (*WITH*)
  484.  
  485. (* Gadget-Text *)
  486.  WITH GText[7] DO
  487.     frontPen := 1; backPen := 0;
  488.     drawMode := jam2;
  489.     leftEdge := -135; topEdge := 0;
  490.     iTextFont := NIL;
  491.     iText := ADR('Geburtsdatum');
  492.     nextText := NIL;
  493.  END; (*WITH*)
  494.  
  495. (* Gadget-Border(s) *)
  496.  WITH Borders[10] DO
  497.     leftEdge := -2; topEdge := -2;
  498.     frontPen := 1; backPen := 0;
  499.     drawMode := jam2;
  500.     count := 5;
  501.     xy := ADR(XY[10]);
  502.     nextBorder := NIL;
  503.  END; (*WITH*)
  504.  
  505.  XY[10,0] := 0;  XY[10,1] := 0; 
  506.  XY[10,2] := 96;  XY[10,3] := 0; 
  507.  XY[10,4] := 96;  XY[10,5] := 11; 
  508.  XY[10,6] := 0;  XY[10,7] := 11; 
  509.  XY[10,8] := 0;  XY[10,9] := 0; 
  510.  
  511. (* String-Info *)
  512.  WITH SInfo[4] DO
  513.     buffer := ADR(Buf[4]);
  514.     undoBuffer := ADR(UBuf);
  515.     bufferPos := 0; dispPos := 0;
  516.     maxChars := 11;
  517.     longInt := 0;
  518.  END; (*WITH*)
  519.  
  520. (*-------------------------------------------------------*)
  521.  
  522. (* Fenster öffnen: *)
  523.  IF (wptr = NIL) THEN
  524.     WPtr := OpenWindow (GadgWindow);
  525.     wptr := WPtr;
  526.  ELSE
  527.     Pos := AddGList (wptr,ADR(Gadgets[0]),0,8,NIL);
  528.     RefreshGList (ADR(Gadgets[0]),wptr,NIL,8);
  529.     WPtr := wptr;
  530.  END; (*IF*)
  531.  
  532. END InitReq2;
  533.  
  534. (*--------------------------------------------------------------------------*)
  535.  
  536. PROCEDURE CloseReq2;
  537. (* Schließen des Gadget-Windows. *)
  538.  
  539. BEGIN
  540.  IF (WPtr#NIL) THEN CloseWindow (WPtr) END;
  541. END CloseReq2;
  542.  
  543. (*--------------------------------------------------------------------------*)
  544.  
  545. PROCEDURE GetReq2GPtr (ID : INTEGER) : ADDRESS;
  546. (* Liefert den GadgetPtr des Gadgets mit der angegebenen ID. *)
  547.  
  548. BEGIN
  549.  RETURN ADR(Gadgets[ID]);
  550. END GetReq2GPtr;
  551.  
  552. (*--------------------------------------------------------------------------*)
  553.  
  554. BEGIN
  555.  WPtr := NIL;
  556. END Req2.